标签: react-native-ios

在react-native-maps中渲染多个标记

Hye,我是新的反应原生,想问我如何在地图中渲染多个标记.

这是我的代码

课内: -

constructor(props) {
super(props);

  this.state = {
   coordinate: ([{
     latitude: 3.148561,
     longitude: 101.652778,
     title: 'hello'
   },
   {
     latitude: 3.149771,
     longitude: 101.655449,
     title: 'hello'
   }
  ]),
 };
Run Code Online (Sandbox Code Playgroud)

}

内部渲染: -

<MapView
        style={styles.map}
        showsUserLocation={true}
        followUserLocation={true}
        zoomEnabled={true}
        //annotations={markers}
      >  
            <MapView.Marker
              coordinate={this.state.coordinate}
              title={this.state.coordinate.title}
            />
      </MapView>
Run Code Online (Sandbox Code Playgroud)

我想在地图中渲染这两个标记,我不知道如何在本地生成循环来渲染它.我已经尝试了文档中的内容,但仍然没有工作.

先感谢您 :)

javascript google-maps-markers react-native react-native-android react-native-ios

13
推荐指数
1
解决办法
2万
查看次数

react-native error RCTJSONStringify()遇到以下错误:JSON写入中的无效类型(NSURL)

我试图在我的react-native应用程序中使用react-native-fbsdk.它一直很好,直到昨天.但是,今天它给出了一个奇怪的错误,说明RCTJSONStringify()遇到以下错误:JSON写入(NSURL)中的类型无效.

RN v0.42.0

这是我的代码:

  _fbAuth(error, result) {
    if (error) {
      console.log("error");
      alert("login has error: " + result.error);
    } else if (result.isCancelled) {
      console.log("login cancelled");
      alert("login is cancelled.");
    } else {
      AccessToken.getCurrentAccessToken().then((data) => {
        console.log("login success");
        console.log(data.accessToken.toString());
        let accessToken = data.accessToken;
        alert(data.accessToken.toString());
        const responseInfoCallback = (error, result) => {
          if (error) {
            console.log(error);
          } else {
            console.log(result);
          }
        }

        const infoRequest = new GraphRequest(
          '/me',
          {
            accessToken: accessToken,
            parameters: {
              fields: {
                string: 'email,name,first_name,middle_name,last_name'
              }
            }
          },
          responseInfoCallback …
Run Code Online (Sandbox Code Playgroud)

ios react-native react-native-ios

13
推荐指数
1
解决办法
1466
查看次数

React-native textAlign justify

Android的

我试图使用textAlign使文本对齐,但它不起作用.

<Text style={{textAlign: 'justify',color:'#1B3D6C', margin: 20}}>
Lorem ipsum dolor sit amet, et usu congue vocibus, ei sea alienum repudiandae, intellegam quaerendum an nam. Vocibus apeirian no vis, eos cu conguemoo scaevola accusamus. Et sea placerat persecutii oinn
</Text>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

编辑:好的,textAlign对齐在Android上不起作用,所以我现在问的是否有一些解决方案?我真的需要!

react-native react-native-android react-native-ios

13
推荐指数
2
解决办法
2万
查看次数

如何在Alert函数上调用onPress中的方法[React-Native]

如何在Alert函数上调用onPress中的方法[React-Native]

<Button
  onPress={{() => Alert.alert(
    'Alert Title',
    'alertMessage',
    [
      {text: 'Cancel', onPress: () => console.log('Cancel Pressed!')},
      {text: 'OK', onPress: () => {this.onDeleteBTN}},

    ],
    { cancelable: false }
  )}}
  >
      <Text> Delete Record </Text>
</Button>
Run Code Online (Sandbox Code Playgroud)

在Alert Dialog上按OK按钮后我需要打电话

onDeleteBTN = () => {
    alert(' OnDelete');
}
Run Code Online (Sandbox Code Playgroud)
{text: 'OK', onPress: () => {this.onDeleteBTN.bind(this)}},
{text: 'OK', onPress: () => {this.onDeleteBTN}},
Run Code Online (Sandbox Code Playgroud)

这不行


javascript reactjs react-native react-native-android react-native-ios

13
推荐指数
1
解决办法
2万
查看次数

React native ScrollView在条件上禁用一个方向

是否可以只向一个方向滚动?我有一个功能,可以检测用户滚动的方向.

但我无法弄清楚如何设置一个标志,如果用户没有回答问题,它将不允许他向右滚动?

谢谢

react-native react-native-scrollview react-native-android react-native-ios

13
推荐指数
1
解决办法
628
查看次数

undefined不是对象(评估'CameraManager.Aspect')

相关错误屏幕

当我的反应相机与React-Native上的项目设置和链接时,我一直遇到这个错误.我尝试了谷歌中找到的所有解决方案,但仍然无法正常工作,我也试过这个视频https://www.youtube.com/watch?v=pJseuSOC8HA并且也没有工作.有人可以试着帮我吗?

这是我的package.json:

"dependencies": {
    "prop-types": "^15.5.8",
    "react": "16.0.0-alpha.6",
    "react-native": "0.44.0",
    "react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git",
    "react-navigation": "^1.0.0-beta.7",
    "react-redux": "^5.0.4",
    "redux": "^3.6.0",
    "redux-promise-middleware": "^4.2.0",
    "redux-thunk": "^2.2.0"
  },
Run Code Online (Sandbox Code Playgroud)

react-native react-native-camera react-native-ios

12
推荐指数
1
解决办法
5541
查看次数

React Native - React Native Architecture

React Native Application Development 是否可以通过MVC,MVP,MVVM等软件架构实现?

谢谢.

architecture react-native react-native-android react-native-ios

12
推荐指数
1
解决办法
6781
查看次数

如何使用Spinner在FlatList中添加更多记录反应本机(意味着-10 - 10条记录)手动!不是从使用服务器端

嗨,我正在开发基于FlatList的示例应用程序,这是我的代码.实际上我显示了整个记录,比如我有50条记录到我的账户.但现在我显示了整整50条记录.Bur我需要在添加10条记录后显示10.但我不知道添加到FlatList.

这是我的代码:

<FlatList
                    data={this.state.profiles}
                    renderItem={({ item, index }) => this.renderCard(item, index)}
                    keyExtractor={item => item.id}
                    ItemSeparatorComponent={() => <Divider style={{ marginTop: 5, marginLeft: width * 0.2 + 20 }} parentStyle={{ backgroundColor: globalStyles.BG_COLOR, alignItems: 'baseline' }} />}
                />


renderCard (profile, index) {
    console.log('rendercard', profile);
    //
    return (
        <View key={profile.id}>
            <ProfileCard
                profile={profile}
                style={styles.card}
                onPress={() => this.props.screenProps.rootNavigation.navigate('Profile', { profile: this.state.profile, id: profile.id })}
                // onPress={() => alert('PROFILE')}
                onAddClick={() => this.setState({ connectionPageVisible: true, cardProfile: profile })}
                connectedIds={(this.props.screenProps && this.props.screenProps.connectedIds) || this.props.connectedIds}
            />
        </View>
    );
}
Run Code Online (Sandbox Code Playgroud)

请告诉我使用活动指标加载更多记录.提前致谢

react-native react-native-android react-native-ios react-native-flatlist

12
推荐指数
1
解决办法
8873
查看次数

我可以使用prop nativeID在本机代码中查找View

是否可以将prop添加nativeID到如下视图中: <View nativeID="viewId">...</View> 然后使用该id在我的原生android和iOS代码中查找视图,以便我可以在其上应用一些本机方法.如果它是一个例子将不胜感激.

react-native react-native-android react-native-ios

12
推荐指数
1
解决办法
171
查看次数

React Native Vector图标不适用于当前版本0.60

反应本机自动链接不适用于反应本机矢量图标。我使用此https://github.com/oblador/react-native-vector-icons/issues/1035将其修复为android

但是在IOS上,我仍然面临问题。请让我知道是否有人解决了此问题...谢谢!

这是我面临的问题的屏幕截图。

在此处输入图片说明

reactjs react-native react-native-ios react-native-vector-icons

12
推荐指数
1
解决办法
4275
查看次数