我已经实现了一个包含TextInput和搜索按钮的搜索栏.这个想法基本上是键入你想要搜索的内容并点击搜索按钮.我的问题是,当TextInput具有焦点时,该按钮是不可点击的.意思是我必须单击两次才能搜索,一次是TextInput失去焦点,一次是点击搜索按钮.
这是我的代码:
<View style={styles.searchView}>
<View style={styles.textInputView}>
<View>
<TextInput style={styles.textInput}
placeholder="Sök användare"
multiline={false}
autoFocus={true}
autoCapitalize="words"
underlineColorAndroid="transparent" />
</View>
</View>
<TouchableOpacity>
<View style={styles.searchButton}>
<Image style = {styles.searchThumbnail}
source = {require('../images/navigatorThumbnails/search.png')}/>
</View>
</TouchableOpacity>
</View>
Run Code Online (Sandbox Code Playgroud)
在TextInput具有焦点时,有没有办法让TouchableOpacity可点击?
我正在使用React Native开发我的第一个应用程序,并遇到了我的第一个问题.对于导航我正在使用导航器.问题是我想将它隐藏在应用程序的登录页面上,但不知道该怎么做.
这是index.ios.js的导航器:
class testApp extends Component {
renderScene(route, navigator) {
switch (route.name) {
case 'home':
return (<Home navigator={navigator} />)
case 'login':
return (<Login navigator={navigator} />)
}
}
render() {
return (
<Navigator
initialRoute={{name: 'login'}}
renderScene={this.renderScene}
configureScene={() => Navigator.SceneConfigs.FloatFromBottomAndroid}
navigationBar={
<Navigator.NavigationBar
routeMapper={NavigationBarRouteMapper}
style = {styles.navigationBar}
/>
}
/>
);
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法隐藏某个页面的导航器?
react-native ×2