dancormier / react-native-swipeout

iOS-style swipeout buttons behind component
MIT License
2.62k stars 646 forks source link

Touchable child must either be native or forward setNativeProps to a native component #276

Open LiuMengzhou opened 6 years ago

LiuMengzhou commented 6 years ago
<TouchableHighlight>
    <Swipeout>
     ...
    </Swipeout>
</TouchableHighlight>

when I'm trying to wrap Swipeout by TouchableHighlight, application falls with error. there is a solution, but I don't know where should I put the snippet.

LiuMengzhou commented 6 years ago

package.json:

"react": "^0.14.5",
"react-native": "^0.25.1",

maybe the version is too low.

LiuMengzhou commented 6 years ago

It works when I wrap the TouchableHighlight with Swipeout. But there is still a bug:

<Swipeout
          backgroundColor="lightblue"
          right={swipeoutBtns}
          style={{ height: 100 }}
        >
          <TouchableHighlight
            style={{ backgroundColor: "red", height: 100 }}
            onPress={() => alert("press")}
            onLongPress={() => alert("longpress")}
          >
            {/* <View style={{ backgroundColor: "green", height: 100 }}> */}

            <View style={{ height: 100 }}>
              <Text>menuItem</Text>
            </View>

            {/* </View> */}
          </TouchableHighlight>
        </Swipeout>

when I swipe left and right for about 10 times, the text "menuItem" disappear. akward :(

platform: iPhoneX - 11.4

  "dependencies": {
    "expo": "^27.0.1",
    "react": "16.3.1",
    "react-native": "~0.55.2",
    "react-native-swipeout": "^2.3.3"
  }