react-native-android

Redirect to screen from an api interceptor (outside of component) in React Native

蓝咒 提交于 2020-01-14 08:44:11
问题 I am working on a React Native application that authenticates requests with JWT tokens. For this purpose i have created axios request and response interceptors to add the token to each request (request interceptor) and redirect the user to the login screen whenever a response has 401 HTTP status (response interceptor). The problem is that i haven't found a way to do the redirect outside of a component. The code below is in an API service that is imported whenever i want an API call to be made

Is it necessary to install Python for react-native on windows for “react-native init AwesomeProject”?

坚强是说给别人听的谎言 提交于 2020-01-14 07:42:08
问题 I am trying to setup react-native on windows7. I have following things installed: C:\Windows\system32>node -v v6.2.0 C:\Windows\system32>npm -v 3.8.9 C:\Windows\system32>javac -version javac 1.8.0_60 I have not installed Python. When i try react-native init AwesomeProject only 2 things are downloaded in AwesomeProject: node_modules dir and package.json { "name": "AwesomeProject", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start"

Detect if shift key is down React Native

懵懂的女人 提交于 2020-01-14 05:54:24
问题 How can I detect if the shift key is currently pressed down? I have a text input, and when the user presses the enter key I only want to submit the form if they are not currently pressing the enter key (same form functionality as Facebook Messenger on desktop). Here is my text input: <TextInput style={styles.input} placeholder={'Enter message'} onKeyPress={this.handleKeyPress} /> And here is the handler: handleMessageInputKeyPress(e) { if(e.nativeEvent.key == "Enter"){ // Now check if the

Detect if shift key is down React Native

倖福魔咒の 提交于 2020-01-14 05:54:06
问题 How can I detect if the shift key is currently pressed down? I have a text input, and when the user presses the enter key I only want to submit the form if they are not currently pressing the enter key (same form functionality as Facebook Messenger on desktop). Here is my text input: <TextInput style={styles.input} placeholder={'Enter message'} onKeyPress={this.handleKeyPress} /> And here is the handler: handleMessageInputKeyPress(e) { if(e.nativeEvent.key == "Enter"){ // Now check if the

React-Native Populate image with URL that has been converted from a blob

£可爱£侵袭症+ 提交于 2020-01-11 04:06:45
问题 I am trying to populate an image with a URl <Image source={{uri: this.state.imageURL}} style={styles.thumb} /> I request the image from the server, using the fetch API, and it returns a blob. I then convert the BLOB into a URL using the following line: var imageURL = window.URL.createObjectURL(attachmentBLOB); When I console.log() the imageURL it prints: blob:http%3A//localhost%3A8081/4ce24d92-0b7e-4350-9a18-83b74bed6f87 I am getting no errors or warning. The image is just not displaying I am

How to build .ipa application for react-native-ios?

跟風遠走 提交于 2020-01-09 04:22:10
问题 I would try "How to generate .ipa file for react-native?" But I'cant get .ipa file. Any one cloud you explain how to get .ipa file . 回答1: How to build .ipa application for react-native-ios : Get ".app" file : Command : react-native run-ios --configuration=release ".app" file path : Build/Products/Release/"<Your_Filename>.app" Convert .app to .ipa : a. Create folder Payload. b. paste .app file into Payload folder. c. compress the Payload folder. d. change the name you want and put extension as

Download file with rn-fetch-blob with POST

十年热恋 提交于 2020-01-07 14:44:24
问题 I'm use rn-fetch-blob, how can I download the file where I need to pass some parameters in the body of the request with POST? I've tried this: RNFetchBlob .config({ // add this option that makes response data to be stored as a file, // this is much more performant. fileCache: true, path: RNFetchBlob.fs.dirs.DownloadDir + '/video.mp4' }) .fetch('POST', `${SERVER}/get_video`, { unique_key: TerminalID(), id_midia: '2' }) .then((res) => { // the temp file path Alert.alert('Caminho', 'The file

Download file with rn-fetch-blob with POST

家住魔仙堡 提交于 2020-01-07 14:43:28
问题 I'm use rn-fetch-blob, how can I download the file where I need to pass some parameters in the body of the request with POST? I've tried this: RNFetchBlob .config({ // add this option that makes response data to be stored as a file, // this is much more performant. fileCache: true, path: RNFetchBlob.fs.dirs.DownloadDir + '/video.mp4' }) .fetch('POST', `${SERVER}/get_video`, { unique_key: TerminalID(), id_midia: '2' }) .then((res) => { // the temp file path Alert.alert('Caminho', 'The file

assembleRelease fails with react-native 0.50

♀尐吖头ヾ 提交于 2020-01-07 05:39:21
问题 Using gradle-plugin 3.0.0 Gradle distribution 4.1.0 react-native 0.50 Linux fedora 27 app name is u1b. Project structure /proj/mob/rn.common (this is where node_modules is and all my js related stuff) /proj/mob/a/u1b -- is where the android app is. the project structure is different than the one normally created by boiler plate react-native create app script (because my node_modules is not just one level up from the android app). But not clear if this is an issue or not. I have been building

How to render items in two columns in react native?

回眸只為那壹抹淺笑 提交于 2020-01-06 06:46:33
问题 my skills in react native is basic, so i want to render items in two columns, i'm using this library https://github.com/GeekyAnts/react-native-easy-grid. componentDidMount() { return fetch(ConfigApp.URL+'json/data_posts.php') .then((response) => response.json()) .then((responseJson) => { this.setState({ isLoading: false, dataSource: responseJson }, function() { }); }) .catch((error) => { console.error(error); }); } Return return ( <Grid> <Col><FlatList data={ this.state.dataSource }