标签: react-native-ios

如何在Objective C中使用RCT_EXPORT_VIEW_PROPERTY检测属性更改?

RCT_EXPORT_MODULE()

- (UIView *)view
{
  return [[RNNativeListview alloc] initWithBridge:self.bridge];
}

RCT_EXPORT_VIEW_PROPERTY(rowHeight, float)
RCT_EXPORT_VIEW_PROPERTY(numRows, NSInteger)
Run Code Online (Sandbox Code Playgroud)

我想在js更新numRows时重新加载我的UITableView.我该怎么听?

objective-c react-native react-native-ios

3
推荐指数
1
解决办法
854
查看次数

React-Native Image Opacity为文本提供不透明度

我使用图像基本上是一个视图,并将文本放在其中,我试图给图像不透明,但每次我尝试文本得到不透明度我也不知道为什么会发生

在此输入图像描述

<View style={{flex: 1}}>
  <View style={{height: 180,}}>
     <Image source={{uri : this.state.fullURLImage}} style={{flex: 1,width: window.width,justifyContent:'center',alignItems:'center',opacity: 0.7}}>
       <Text style={{textAlign: 'center',fontWeight: 'bold',color:'white',fontSize:16,}}>{this.state.title}</Text>
       <Text style={{color:'white',fontSize:14,}}>{'\n'}July {this._try(this.state.day)} | {this.state.time_start} - {this.state.time_end}</Text>
     </Image>
  </View>

  <View style={{flexGrow: 1, backgroundColor: 'white',}}>
     <Text style={{textAlign:'center',color:'#1B3D6C',fontWeight:'bold',margin:10,marginTop: 40}}>{this.state.author}</Text>
     <Text style={{margin:10,textAlign: (Platform.OS === 'ios') ? 'justify' : 'left'}}>{this.state.text}</Text>

  </View>
  <Image
     source={{uri : this.state.fullURLAuthor}}
     style={{
        position: 'absolute',
        top: 180 - 64 / 2,
        height: 64,
        width: 64,
        left: (Dimensions.get('window').width - 64) / 2,
        borderRadius: 32,
     }}
  />
</View>
Run Code Online (Sandbox Code Playgroud)

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

3
推荐指数
1
解决办法
9677
查看次数

在 react-native 中创建粒子效果

我想在我的本机应用程序的背景中创建粒子效果。

我正在寻找这样的东西:http : //vincentgarreau.com/particles.js/

我似乎找不到可以完成这项工作的软件包。

提前致谢!

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

3
推荐指数
1
解决办法
2072
查看次数

React Native:单击按钮时呈现组件

我有一个要在用户单击按钮时呈现的组件列表。该屏幕应该是一个搜索屏幕,用户可以在其中输入查询内容,当他们点击搜索按钮时,就会显示结果列表。但是,当我尝试使用 onPress 进行组件渲染时,没有任何反应。对于这个例子,我只是打印文本而不是使用地图来打印组件。

renderResults() {  
   return <Text> Doesn't get printed </Text>
  }

  render() {
    return (
      <View>
        <Button
          onPress={ this.renderResults.bind(this) } //use .bind(this) to access state in renderResults
          title="Search!"
          color="#841584" />
       </View>
      );
  }
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-native-ios

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

如何在反应导航中完全更改抽屉的背景颜色

如何完全更改抽屉的背景颜色?我不需要改变抽屉项目需要完全改变抽屉的背景颜色。默认情况下,它是白色的,而我需要将其设为绿色。有演示示例吗?

reactjs react-native react-native-android react-native-ios react-navigation

3
推荐指数
1
解决办法
6258
查看次数

在 React Native 中访问和理解 SectionList

我是 React Native 的新手,我来自 iOS 背景。有人可以告诉我关于 iOS 的 Sectionlist 吗?我已经阅读了一些官方和博客教程,但无法理解。我有一个示例 json :

[{"key":"New","data":[{"name":"Foo1"},{"name":"Foo2"}]},{"key":"Old","data":[{"name":"Foo3"},{"name":"Foo4"}]}]
Run Code Online (Sandbox Code Playgroud)

通过对“ /sf/answers/3262098171/ ”的一些了解,我试图访问项目名称,我得到了结果,名称正在显示。但是当我把儿子改成:

[{"key":"New","gender":"male","name":{"title":"mr","first":"janique","last":"costa"},"registered":"2014-09-22 22:38:28","phone":"(48) 4518-1459","cell":"(22) 3632-3660"},{"key":"New11111","gender":"male11111","name":{"title":"mr11111","first":"janique11111","last":"costa11111"},"registered":"2014-09-22 22:38:2811111","phone":"(48) 4518-145911111","cell":"(22) 3632-366011111"}]
Run Code Online (Sandbox Code Playgroud)

并尝试访问性别,我收到错误:“类型错误:未定义不是对象(正在评估'section.data.length')”

_renderItem = ({ item, section }) => (<Text>{section.key}</Text>)

    _renderSectionHeader = ({ section }) => {
      return (
        <View style={styles.sectionHeader}>
          <Text style={styles.header}>{section.key}</Text>
        </View>
      )
    }

render() {
    return (


      <View style={styles.container}>
        <SectionList
            sections={data}
            renderItem={this._renderItem}
            renderSectionHeader={this._renderSectionHeader}
        />
      </View>


    );
  }
Run Code Online (Sandbox Code Playgroud)

reactive-programming ios react-native react-native-ios

3
推荐指数
1
解决办法
2889
查看次数

在iOS模拟器上需要未知模块“ 11”错误

当我用。运行react native项目时,react-native run-ios它在我的iOS模拟器上显示以下错误。在我的android模拟器上,这完全没问题。我已删除节点模块并重新安装。但是错误仍然存​​在。我不想完全删除我的ios / build文件夹,因为我在其中手动添加了库依赖项,并且第三方库在我的本机项目中正常工作。有人可以帮我吗?

错误信息

需要未知模块“ 11”。如果确定模块在那里,请尝试重新启动Metro Bundler。您可能还需要运行yarn或npm install(取决于您的环境)。

iOS上的错误消息

package.json

{
  "name": "AwwsomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-navigation": "^1.1.473",
    "react-native-vector-icons": "^4.6.0"
  },
  "devDependencies": {
    "babel-jest": "23.2.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.2.0",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
Run Code Online (Sandbox Code Playgroud)

react-native react-native-ios react-native-navigation

3
推荐指数
3
解决办法
3527
查看次数

急速模块图中不存在模块“反应”

我正在尝试在我的应用程序中进行LinkedIn集成。所以,我做了如下:

安装的依赖项如下:

npm install react-native-linkedin --save;

因此,在启动应用程序时,出现以下错误:

Failed to load bundle(http://localhost:8081/index.bundle?
platform=ios&dev=true&minify=false)with
error:(Unable to resolve module 'react' from
'mypath/App.js':Module 'react' does not exist
in the Haste module map
Run Code Online (Sandbox Code Playgroud)

可能是什么问题?谢谢。

linkedin react-native linkedin-api react-native-android react-native-ios

3
推荐指数
1
解决办法
2934
查看次数

iPhone X中调度的不受支持的顶级事件类型“ onGestureHandlerStateChange”

我在遇到问题react-navigation-drawer

"react-native-gesture-handler": "^1.0.16",
"react-navigation": "^3.3.2"
Run Code Online (Sandbox Code Playgroud)

这两个版本已安装。抽屉在Android和iPhone 5S中正常工作。但是,当我在iPhone X中运行该应用程序时,通过手势打开抽屉会引发错误。

调度了不受支持的顶级事件类型“ onGestureHandlerStateChange”

ios react-native react-native-ios react-navigation react-navigation-drawer

3
推荐指数
2
解决办法
1345
查看次数

为什么我应该/不应该升级到本机0.60.0?

当前,react-native已发布了0.60.0版,并且进行了重大更改,但他们在此版本中添加了许多本机支持。

我目前在做3个项目。

First Project Info
- react: 16.0.0-beta.5 => 16.0.0-beta.5
- react-native: 0.49.0 => 0.49.0
this project containes lots of third party libraries and some of them not event maintained by owners.

Second Project Info
- react: 16.6.3 => 16.6.3
- react-native: 0.57.8 => 0.57.8
this project containes 12 third party libraries.

Third Project Info
- react: 16.8.5 => 16.8.5
- react-native: 0.59.2 => 0.59.2
this project containes 7 third party libraries.

Currently, all three projects are working in debug …

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

3
推荐指数
1
解决办法
1133
查看次数