javascript - React Native 风格复选框和文本分隔

标签 javascript reactjs react-native ecmascript-6

我正在尝试为应用程序制作一个注册页面。我想放置一个复选框来接受条款和条件,但我不知道如何将复选框稍微放在文本的左侧。目前,它被放在文本的第一个字母上

<View style={{flexDirection: 'row', alignItems: 'center'}>
     <CheckBox style =checked={this.state.agreeTNCs} onPress={() => this.setState({agreeTNCs: !this.state.agreeTNCs})} testID="tncsBox"/>
     <Hyperlink linkStyle={{color: '#2980b9'}} onPress={() => this.props.screenChangeHandler(routes.loggedOut.termsAndConditions)}>
         <Text>I agree to the Nowzi Terms and Conditions</Text>
     </Hyperlink>
</View>

最佳答案

尝试在两者之间添加不间断空格:

<View style={{flexDirection: 'row', alignItems: 'center'}>
     <CheckBox style =checked={this.state.agreeTNCs} onPress={() => this.setState({agreeTNCs: !this.state.agreeTNCs})} testID="tncsBox"/>
     &nbsp;
     <Hyperlink linkStyle={{color: '#2980b9'}} onPress={() => this.props.screenChangeHandler(routes.loggedOut.termsAndConditions)}>
         <Text>I agree to the Nowzi Terms and Conditions</Text>
     </Hyperlink>
</View>

关于javascript - React Native 风格复选框和文本分隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47720656/

相关文章:

javascript - 使用 jquery 读取弹出窗口中输入字段的值时出现问题

javascript - 如何抑制 IE9 window.close() 确认消息

javascript - 如果 Angular 模型中没有数据则显示消息

reactjs - 设置 localStorage 以使用 jest 测试 React 应用程序

android - npm 安装时 react 导航错误

react-native - 博览会-本地通知在设备上不起作用

ios - React-Native:无法输出到 console.log()?

javascript - 我如何使背景图像可以右键单击?

javascript - 在 react-native 中查找组件的特定子项

javascript - 如何分别管理两个不同输入的状态