小编ara*_*ddy的帖子

新闻上的可触摸不透明度在 SVG 标签内不起作用

我有一个组件,里面<Svg>有一个按钮(<TouchableOpacity>with <View>)。

虽然按钮onClick独立工作正常,但当我将组件包装在 SVG 中时它不起作用。

<Svg width={'100%'} height={'100%'} viewBox='0 0 360 243' {...props}>
  <Defs>
    <LinearGradient
        id='prefix__b'
        x1={'75.7%'}
        y1={'34.3%'}
        x2={'84.6%'}
        y2={'-9.6%'}
        gradientUnits='objectBoundingBox'
    >
      <Stop offset={1} stopColor='#2ff290' />
    </LinearGradient>
  </Defs>
  <View >
    <TouchableOpacity
                      onPress={() => {
      console.log('DSDA')
      }}
      ><Text>Click me!!</Text>
    </TouchableOpacity>
  </View>
</Svg>
Run Code Online (Sandbox Code Playgroud)

https://github.com/react-native-community/react-native-svg/issues/1050

javascript svg reactjs react-native

14
推荐指数
1
解决办法
1233
查看次数

如何允许react-native启用对JSX(扩展)文件的支持

React Native应用程序无法解析组件.

我正在尝试导入和渲染Test.jsx内部App.js.

我收到以下错误 -

error: bundling failed: Error: Unable to resolve module `./screens/Test` from App.js`:
The module `./screens/Test` could not be found from App.js. Indeed, none of these files exist
Run Code Online (Sandbox Code Playgroud)

项目经理(或者说文件)看起来像这样 -

档

测试代码.js-

import React, { Component } from 'react';
import {View, Text, StyleSheet} from 'react-native'

export default class Test extends Component {
    render() {
      return (
        <View style={styles.container}>
          <Text>Hello World?</Text>
        </View>
      );
    }
  }


const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center', …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native

6
推荐指数
4
解决办法
4831
查看次数

如何使用 Enzyme 测试 antd Dropdown

这是我写的代码:

import {Dropdown, Menu} from 'antd';
class comp extends Component {
    state = {
      concept: 'Concept',
    }

    menuItemSelection=({key}) => {
      this.setState({
        concept: key
      })
    }

    menu = (
      <Menu onClick={this.menuItemSelection}>
        <Menu.Item key='ab'>ab</Menu.Item>
        <Menu.Item key='mw'>mw</Menu.Item>
        <Menu.Item key='va'>va</Menu.Item>
      </Menu>
   )

    render() {
      const {concept} = this.state
      return (
        <div>
            <Dropdown overlay={this.menu}>
              <div>{concept}</div>
            </Dropdown>
                 </div>
      )
    }
}

export default comp;
Run Code Online (Sandbox Code Playgroud)

这是我的界面目前的工作方式:

当我将鼠标悬停在 DropDown 上时,菜单将出现,当单击任何项​​目时,它们会被选中并且状态变量概念会更新。我如何测试这个 DropDown?我无法访问菜单来模拟菜单上的“点击”。

component = mount(<comp />)
    const dropdown = component.find(Dropdown) // this i am able to find 
    const menuInstance …
Run Code Online (Sandbox Code Playgroud)

javascript unit-testing reactjs jestjs enzyme

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

单击外部或按 Esc 键时停止模态关闭

单击外部或按Esc键时停止模式关闭

<Modal
    id='VideoPlayer'
    modalOptions={{ dismissible: false }}
    trigger={
           <VideoPlay
        className='modal-close'
        id='myBtn3'> PLAY VIDEO
      </VideoPlay>
      }
  >
    <div id='overlay' className='modal-close modal-action' data-toggle='VideoPlayer' onClick={this.handleClose}>
      <i className='material-icons close'>close</i>
    </div>
    <div className='flowplayer'>
      <video id='Player1'>
        <source type='video/webm' src='//edge.flowplayer.org/bauhaus.webm' />
        <source type='video/mp4' src='//edge.flowplayer.org/bauhaus.mp4' />
      </video>
    </div>
  </Modal>
Run Code Online (Sandbox Code Playgroud)

我正在使用react-materialize模态http://react-materialize.github.io/#/modals

我认为背景和键盘默认设置为 true。所以我的问题是如何使背景为静态,键盘为假。我尝试了各种方法,例如使用 jquery,但没有任何效果。

reactjs

5
推荐指数
1
解决办法
5365
查看次数

如何禁用文本输入中文本下的行 android react native

我正在尝试在 react-native(android) 中呈现文本输入,它下面有一行是从borderBottomWidth属性中获取的,当我输入时,出现了两行看起来不太好并且无法删除它我尝试给出underlineColorAndroid='transparent'但是没用

import * as React from 'react';
import { Text, View, StyleSheet,TextInput } from 'react-native';
import Constants from 'expo-constants';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <TextInput
          autoCapitalize='none'
          autoCorrect={false}
          underlineColorAndroid='rgba(0,0,0,0)'
          style={styles.textInput}
         />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#000',
    padding: 8,
  },
  textInput: {
    paddingVertical: 0,
    marginHorizontal: 10,
    textAlign: 'center',
    height: 18,
    fontSize: 14,
    alignSelf: 'flex-start',
    borderStyle: …
Run Code Online (Sandbox Code Playgroud)

android reactjs react-native

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