小编Aay*_*and的帖子

如何在React-native中绘制其他应用程序

我试图在我的本机应用程序中创建像聊天头一样的facebook Messenger.我使用pan响应器创建拖动效果并折叠到副作用但我无法弄清楚如何使聊天头可见于其他应用程序或手机的主屏幕.我的应用程序已包含SYSTEM_ALERT_WINDOW权限.这是我的聊天头代码到目前为止.任何领导将不胜感激.

const width = Dimensions.get('window').width
const widthFactor = width / 375
const heightFactor = (Dimensions.get('window').height - 75) / 667

export default class App extends Component {
  constructor(props) {
    super(props)

    this.state = {
      showDraggable: true,
      dropZoneValues: null,
      pan: new Animated.ValueXY(),
    }

    this.panResponder = PanResponder.create({
      onStartShouldSetPanResponder: () => true,
      onPanResponderMove: Animated.event([
        null,
        {
          dx: this.state.pan.x,
          dy: this.state.pan.y,
        },
      ]),
      onPanResponderRelease: (e, gesture) => {
        if (this.isDropZone(gesture)) {
          this.setState({
            showDraggable: false,
          })
        } else {
          const k =
            gesture.dx > 0
              ? …
Run Code Online (Sandbox Code Playgroud)

react-native

10
推荐指数
0
解决办法
1123
查看次数

标签 统计

react-native ×1