react-native

console.error: "fontFamily 'Helvetica Neue' is not a system font and has not been loaded through Expo.Font.loadAsync

守給你的承諾、 提交于 2021-02-19 07:43:13
问题 In my react-native app i have added a package for event calendar Package link. Which gives me an error message console.error: "fontFamily 'Helvetica Neue' is not a system font and has not been loaded through Expo.Font.loadAsync. App.js import React from 'react'; import { StyleSheet, Text, View, Dimensions, StatusBar } from 'react-native'; import Header from 'react-native'; import { WelcomeScreen } from './screens/WelcomeScreen'; import EventCalendar from 'react-native-events-calendar'; let {

React Native XHR multipart/form-data send data as [object Object]

删除回忆录丶 提交于 2021-02-19 06:12:46
问题 I'm trying to send a multipart/form-data from React Native (Running on Simulator) to backend server using XHR with the following code let xhr = new XMLHttpRequest(); xhr.open('POST', 'http://....url....'); let formdata = new FormData(); formdata.append('title','This is awesome'); xhr.send(formdata); However in console log the Request Payload are shown as [object Object] So I decided to take the same code and put it in an HTML file and run from Chrome browser and Request Payload from console

React Native XHR multipart/form-data send data as [object Object]

我们两清 提交于 2021-02-19 06:10:55
问题 I'm trying to send a multipart/form-data from React Native (Running on Simulator) to backend server using XHR with the following code let xhr = new XMLHttpRequest(); xhr.open('POST', 'http://....url....'); let formdata = new FormData(); formdata.append('title','This is awesome'); xhr.send(formdata); However in console log the Request Payload are shown as [object Object] So I decided to take the same code and put it in an HTML file and run from Chrome browser and Request Payload from console

With animated transform,onLayout cannot be triggered

ⅰ亾dé卋堺 提交于 2021-02-19 05:41:05
问题 My codes render a red square and moved using PanResponder.After release pan ,it move by animation transform. But onLayout() does not trigger when I drag the square. I want to get the square location anytime even in animating. What is the problem? <View style={styles.container}> <Animated.View style={[ styles.box, { transform: [ { translateX: this._animatedValue.x }, { translateY: this._animatedValue.y }, ], backgroundColor: 'red' }, ]} {...this._panResponder.panHandlers} onLayout={({

Cannot add a child node that doesn't have a YogaNode to a parent without measure function

淺唱寂寞╮ 提交于 2021-02-19 05:18:41
问题 Click here for an image of the screenshot Trying to create a log-in form which reads information from a firebase database through axios; getting an error related to YogaNodes. Read about this; I think there must be something wrong with the JSX syntax. But both SublimeLinter (the text editor I use) and I can't seem to figure out what's wrong. Pretty sure the components imported (Card, CardSection, Button, Spinner) are fine since those are reusable components I have been using with my other

React-Navigation: navigate from actions file

情到浓时终转凉″ 提交于 2021-02-19 03:58:07
问题 I'm new to RN and JS. I want to navigate once a login action is complete, but I cannot get it to work. I am using firebase. This is from my actions file. It throws a firebase error: export const LOGIN_USER_SUCCESS = 'login_user_success'; export const loginUserSuccess = (dispatch, user) => { dispatch({ type: LOGIN_USER_SUCCESS, payload: user }); this.props.navigation.navigate('groupMain'); // this doesnt work }; I also tried putting it into the Login component - this might be a step in right

JavaScript: How to group nested array

风格不统一 提交于 2021-02-19 03:50:07
问题 I am trying to display data using SectionList in React Native. I have written the code below displaying what I am trying to accomplish. I want the data to first be grouped together by date , and inside of that date, I need them grouped by location. A regular JavaScript solution will work. It's important that it has a title and data key. My input data is in this format: [ { game_id: 1171, date: '2018-11-17', location: 'Plaza' }, { game_id: 1189, date: '2018-11-17', location: 'Field - Kickball'

How to test async function with spyOn?

半腔热情 提交于 2021-02-19 02:57:09
问题 I am trying to test an async function in a react native app. class myClass extends React.Component { ... closeModal = async () => { if (someCondition) { await myFunction1(); } else { await myFunction2(); } this.props.navigation.state.params.onGoBack(); this.props.navigation.navigate('Main'); }; ... } This is my test: const navigation = { navigate: jest.fn(), state: { params: { onGoBack: jest.fn() } }, }; const renderComponent = overrides => { props = { navigation, ...overrides, }; return

How to test async function with spyOn?

别来无恙 提交于 2021-02-19 02:57:09
问题 I am trying to test an async function in a react native app. class myClass extends React.Component { ... closeModal = async () => { if (someCondition) { await myFunction1(); } else { await myFunction2(); } this.props.navigation.state.params.onGoBack(); this.props.navigation.navigate('Main'); }; ... } This is my test: const navigation = { navigate: jest.fn(), state: { params: { onGoBack: jest.fn() } }, }; const renderComponent = overrides => { props = { navigation, ...overrides, }; return

Sharing code between React Native + Node

落爺英雄遲暮 提交于 2021-02-19 02:27:22
问题 I am using React Native and Node.js. I want to share code between the two. My folder structure is as so. myreactnativeapp/ mynodeserver/ myshared/ In the react native and node apps I have included the package.json "dpendencies" : { "myshared": "git+https://myrepository/ugoshared.git" } This can then be included in each project via require/import etc. This all works fine and for production I'm happy with it. (Though I'd love to know a better way?) The issue I'm facing is in development it's