react-native

How to use react-navigation's headerLeft and headerRight

徘徊边缘 提交于 2021-02-08 07:58:30
问题 Using react-navigation, found that headerLeft did not respond? And there is no headerLeft, headerRight class Message extends React.Component { static navigationOptions = { tabBarLabel: '消息', headerTitle: () => ( <View style={styles.headerWrapper}> <Text adjustsFontSizeToFit style={styles.headerText}>消息</Text> </View> ), tabBarIcon: ({ focused, tintColor }) => ( <Image source={focused ? require('../images/clickmessage.png') : require('../images/message.png')} style={{ width: 26, height: 26,

access environment variable in React-Native AndroidManifest.xml

这一生的挚爱 提交于 2021-02-08 07:40:08
问题 I'm new to React Native. The task at hand is to set my Google API key in AndroidManifest.xml without exposing it, when pushed to GitHub. I set up an environment variable called API_KEY, but however I want to access it in the .xml , I get an error when trying to spin up the dev server. So far I tried: android:value=${env.API_KEY} android:value="${env.API_KEY}" android:value="${API_KEY}" Thank you! 回答1: assuming that you have defined the key in your .env file, you can set that up on build

How to do Reverse Geocoding in react native

倾然丶 夕夏残阳落幕 提交于 2021-02-08 07:39:38
问题 I am trying to get my current location in react native, using react-native-geolocation I get latitude and longitude of my location. Now I want to convert them into the location's address without using the Google API key. Is there any way to convert latitude longitude into an address without using the Google API key? 回答1: There are many ways to convert lon/lat to address without using Google Maps API. Search reverse geocoding api and you'll find a bunch of alternatives. A few months ago I was

How to do Reverse Geocoding in react native

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-08 07:39:04
问题 I am trying to get my current location in react native, using react-native-geolocation I get latitude and longitude of my location. Now I want to convert them into the location's address without using the Google API key. Is there any way to convert latitude longitude into an address without using the Google API key? 回答1: There are many ways to convert lon/lat to address without using Google Maps API. Search reverse geocoding api and you'll find a bunch of alternatives. A few months ago I was

React-native how to move up Textfield above keyboard

末鹿安然 提交于 2021-02-08 06:51:11
问题 I am trying to move textfields up while showing the keyboard. I am doing login screen in react native application, So, I have added Scrollview . But, Its scrolling for all devices. But, I need only for iPhone 5s device only. Even I tried with KeyboardAvoidingView , But, due to this entire data is overlapping. Any suggestions to avoid this issue? 回答1: You have to use KeyboardAvoidingView but not with scrollview because scrollview does not have a height. If you have to use KeyboardAvoidingView

React-native how to move up Textfield above keyboard

痴心易碎 提交于 2021-02-08 06:50:01
问题 I am trying to move textfields up while showing the keyboard. I am doing login screen in react native application, So, I have added Scrollview . But, Its scrolling for all devices. But, I need only for iPhone 5s device only. Even I tried with KeyboardAvoidingView , But, due to this entire data is overlapping. Any suggestions to avoid this issue? 回答1: You have to use KeyboardAvoidingView but not with scrollview because scrollview does not have a height. If you have to use KeyboardAvoidingView

How do I upload an image taken by React-Native-camera to Firebase storage?

◇◆丶佛笑我妖孽 提交于 2021-02-08 06:02:35
问题 takePicture = async function() { if (this.camera) { const options = { quality: 0.5, base64: true, mirrorImage: true }; const data = await this.camera.takePictureAsync(options) this.setState({path: data.uri}) } } takePicture is the function to capture the image. Now I want to save the captured image and upload it to Firebase storage. this.setState({path: data.uri}) updates the path to clicked Image's location. How do I use react native fetch blob to upload my image in firebase storage? Please

React Native - catch all touch events but Touchable's are not bubbling

雨燕双飞 提交于 2021-02-08 05:42:15
问题 I've made a tooltip and I want it to close on a touch event outside the tooltip. However I don't want to make an opaque view because I still want the touch to work on whatever was pressed. I tried wrapping my app in a TouchableWithoutFeedback : <TouchableWithoutFeedback onPress={(e) => this.onAppTouch(e)}> This works if the element pressed isn't a Touchable , but otherwise the event seems to get swallowed and not bubble up to that top level onPress . Is there a way to get this to work or else

How to change the color of the active / selected tab?

北城以北 提交于 2021-02-08 05:21:33
问题 I want the color to be the default gray color when the tab is not selected but to be my tabBarColor color when the tab is selected. I could not find a way to change the color of the title in the tab bar. How can I do that? This is my code: Home:{ screen: TabNavigator({ Home: { screen: HomeScreen, navigationOptions: ({ navigation }) => ({ title: 'Home', tabBarIcon: ({ tintColor, focused }) => ( <Ionicons name={focused ? 'ios-home' : 'ios-home-outline'} size={26} style={{ color: focused ? `$

React Native Picker with Image Icon

余生颓废 提交于 2021-02-08 05:20:22
问题 I am trying to build a language selection picker in react native which has a picture of the country's flag next to the label, like this: The icons have to be images and not unicode. I've had a look around but there doesn't seem to be anything available. Does anyone know of anything I can use to create this? If nothing can be used then I will create a custom picker, I aim to make use of a ScrollView to handle the scrolling but I am not sure what I can use to replicate the rotation effect of