在react-native中我有一个TextInput元素,当你点击它时,键盘会根据需要弹出.然而,问题是,我有你点击,当你输入你的输入输入到TextInput但按钮上的第一触摸或其他任何地方总是只删除键盘和不运行上的箭头按钮onPress功能的箭头按钮.当我输入文本并仍然使用键盘时,如何制作它.下一次按下都会移除键盘并执行按钮上的onPress功能.现在用户必须双击.一旦删除键盘,然后第二次执行onPress的功能.
<View style={{flex: 1,backgroundColor: "#b70f42", justifyContent: "center", alignItems: "center"}}>
<View style={{position: "relative"}}>
<TextInput
style={{color: "#FFF", borderBottomColor: "#FFF", borderBottomWidth: 1,fontSize:30,padding: 0, paddingRight: 50,height: 40,width: this.state.width*3/4,shadowOffset: { width: 0, height: 0 }, shadowColor: 'black', shadowOpacity: 0.5, shadowRadius: 5}}
onChangeText={(passwordInput) => this.showArrow(passwordInput)}
value={this.state.passwordInput}
placeholder="Vart ska du?"
placeholderTextColor="#FFF"
/>
<Text style={{marginLeft: 175,color:"#FFF"}}>Powered by IBM</Text>
<TouchableHighlight underlayColor="rgba(255,255,255,0)" style={{position: "absolute", top: 0, right: 5,}} onPress={() => this.onSearchButtonClick()}>
<Animated.Image
source={require("../../img/right-arrow.png")}
style={{width:40, height: 40,opacity: this.state.arrowOpacity}}>
</Animated.Image>
</TouchableHighlight>
</View>
</View>
Run Code Online (Sandbox Code Playgroud) 有没有办法将地图限制在特定区域,以便平移和缩放包含在该区域内,而外部的所有内容都被锁定?我想限制用户可以在地图上看到的区域。我通过react-native-maps使用谷歌地图https://github.com/react-community/react-native-maps
这是我的代码,目前您可以缩放多远或可以向两侧平移多少没有限制
<View style={styles.container}>
<MapView style={styles.map}
provider= { PROVIDER_GOOGLE }
customMapStyle={mapStyle}
initialRegion={{
latitude: 59.2937025,
longitude: 18.0813377,
latitudeDelta: 0.012,
longitudeDelta: 0.012,
}}
/>
</View>
Run Code Online (Sandbox Code Playgroud)