小编Hen*_*hli的帖子

来自图像文件的二维码解码器(本机反应)

我正在寻找一种方法来从 React Native(特别是 ios)中的图像文件解码二维码......我知道世博会提供了相机扫描仪解决方案......但我需要文件解码器

很感谢任何形式的帮助。

qr-code react-native expo

8
推荐指数
1
解决办法
6000
查看次数

图像 Base64 字符串到 Uint8ClampedArray

我有从Expo ImagePicker 组件返回的 base64 格式的图像数据,我想将其转换为 [r0, g0, b0, a0, r1, g1, b1, a1, ...] 形式的 RGBA 像素值的 Uint8ClampedArray,因为它是jsQR 库接受的唯一输入

我试过这个,但没有用:

const dataURItoBlob = byteString  => {

  // write the bytes of the string to a typed array
  var ia = new Uint8ClampedArray(byteString.length);
  for (var i = 0; i < byteString.length; i++) {
    ia[i] = byteString.charCodeAt(i);
  }

  return ia;
};
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激

javascript qr-code image react-native

6
推荐指数
2
解决办法
4334
查看次数

React Native ScrollView的scrollTo函数不起作用

如果在组件的事件中满足特定条件,我试图滚动到顶部componentWillReceiveProps......但什么也没有发生:

componentWillReceiveProps(nextProps) {
     // some code...

    if (newQuery === query && this.scrollViewRef.current) {
      console.log('Should scroll to top'); // << logs successfully

      this.scrollViewRef.current.scrollTo({
        x: 0,
        y: 0,
        duration: 500,
        animated: true,
      });
    }
  }
Run Code Online (Sandbox Code Playgroud)

我如何为滚动视图创建引用的代码片段:

class SearchResult extends React.Component {
  constructor(props) {
    super(props);

    this.scrollViewRef = React.createRef();
  }
//...
}
Run Code Online (Sandbox Code Playgroud)

渲染方法:

render () {
   return (
      <ScrollView
        ref={this.scrollViewRef}
        contentContainerStyle={{ marginVertical: 8 }}
      >
    ...
    )
}
Run Code Online (Sandbox Code Playgroud)

我还尝试通过按下按钮手动滚动......也不起作用

有什么帮助吗?

reactjs react-native

6
推荐指数
1
解决办法
9563
查看次数

如何访问 Screen 组件内的 NavigatorScreen &gt; 选项?

有什么方法可以访问组件options内的导航器屏幕对象Home吗?

    <Stack.Navigator>
        <Stack.Screen
            name="Home"
            component={Home}
            options={
                {
                    /** some options... */
                }
            }
        />
        <Stack.Screen name="About" component={About} />
    </Stack.Navigator>
Run Code Online (Sandbox Code Playgroud)

function Home() {
    /** Get options object here */
    return (
        /** some jsx */
    );
}
Run Code Online (Sandbox Code Playgroud)

我正在使用反应导航5

react-native react-navigation react-navigation-v5

6
推荐指数
1
解决办法
721
查看次数

如何在React Navigation 6中隐藏特定屏幕中的tabBar?

如何在react-navigation 6...中的特定屏幕中隐藏选项卡栏而不更改导航结构,因为它是此处文档中唯一可用的选项

react-native react-navigation react-navigation-v6

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

在何处放置功能组件的辅助功能?最适合表现的是什么?

我们将助手放置在功能组件中的位置会影响组件的性能……我的意思是说在性能上哪个更好……将其放置在组件的内部还是外部?

const onPress = () => {}; // here

const MyComponent = () => {
  const onPress = () => {}; // < or here
  return (<TouchableOpacity onPress={onpress}>...</TouchableOpacity>);
};
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

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

如何在 React Native 中将视图的方向属性设置为 RTL

如何View在react-native中设置a的方向属性...类似:

<View direction="rtl" />

或者

在使我的应用程序 RTL 就绪后,无论当前的设备语言如何,如何强制整个应用程序的方向从右到左

reactjs react-native

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