在React Native中加载ActivityIndi​​cator时如何禁用触摸屏?

时间:2018-11-01 05:42:36

标签: javascript android ios reactjs react-native

我想在加载时禁用触摸屏(我使用ActivityIndi​​cator)。我放置了pointerEvents = {'none},但它不起作用。你能给我一个解决方案吗?

import React from "react";
import { TouchableWithoutFeedback, View, ActivityIndicator } from "react-native";
import Colors from "../../resources/colors/Colors";

const AppProgress = () => (
    <View pointerEvents={"none"}
      style={{
        width: "100%",
        height: "100%",
        backgroundColor: Colors.dimBlack,
        position: "absolute",
        alignSelf: "center",
        justifyContent: "center",
        alignItems: "center"
      }}>
      <ActivityIndicator size="large" color={Colors.green}/>
    </View>
);

export default AppProgress;

版本:

反应:16.4.1 => 16.4.1 反应本机:0.56.0 => 0.56.0

2 个答案:

答案 0 :(得分:0)

您已经正确地完成了所有操作,只是可以尝试在视图样式中使用高价值的zIndex,因为其他一些视图可能会将其重叠。

答案 1 :(得分:0)

import re

s =  "66645hello world"
m = re.search(r'[a-zA-Z]', s)
index = m.start()