小编Ted*_*Ted的帖子

将Button添加到我的React Native App时出现了一些错误?

**添加按钮时我遇到了一些问题!!**

并在应用程序中,这是错误

java.lang.string无法强制转换为com.facebook.react.uimanager.accessibility DelegateUtil $ accessibilityRole

错误按钮


我的简单代码

import React, { Component } from "react";
import { StyleSheet, TextInput, View, Button, Text } from "react-native";

export default class App extends Component {
  state = {
    placeName: ""
  };

  placeNameChangeHandler = val => {
    this.setState({
      placeName: val
    });
  };

  onPressLearnMore = () => {
    alert("Pressed");
  };

  render() {
    return (
      <View style={styles.container}>
        <Button
          onPress={this.onPressLearnMore}
          title="Learn More"
          color="#841584"    
        />

        <TextInput
          style={{
            width: 300,
            borderBottomWidth: 1,
            borderBottomColor: "#333"
          }}
          placeholder="Enter Name.."
          value={this.state.placeName}
          onChangeText={this.placeNameChangeHandler}
        /> …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-native redux

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

在关闭引导程序中的模态后,如何解除模态触发按钮的聚焦

关闭模态后,我似乎无法模糊按钮.

$('#exampleModal').on('hidden.bs.modal', function(e){
        $('button').blur();
    });
Run Code Online (Sandbox Code Playgroud)

我已经尝试了上面的内容,它似乎仍然没有模糊.我几乎尝试了一切.唯一的解决方案是设置超时并在模型完成隐藏转换后将其模糊.更好的解决方案?

modal-dialog twitter-bootstrap twitter-bootstrap-3

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

如何使ReactJS中的表可排序?

我正在ReactJS中构建一个简单的应用程序,它通过调用某个API来使用JSON数组.然后我在表中填充数组的结果.我现在想让表的列可以排序.有人可以帮助我.这是我的代码.

class ParentComponent extends Component {
  constructor(props) {
    super(props);
    this.state = { data: [] };
  }

  componentDidMount() {
    fetch("http://hostname:xxxx/yyyy/zzzz")
      .then(function(response) {
        return response.json();
      })
      .then(items => this.setState({ data: items }));
  }

  render() {
    var newdata = this.state.data;

    return (
      <table className="m-table">
        <thead>
          <tr>
            <th>AccountName</th>
            <th>ContractValue</th>
          </tr>
        </thead>
        <tbody>
          {newdata.map(function(account, index) {
            return (
              <tr key={index} data-item={account}>
                <td data-title="Account">{account.accountname}</td>
                <td data-title="Value">{account.negotiatedcontractvalue}</td>
              </tr>
            );
          })}
        </tbody>
      </table>
    );
  }
}

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

javascript jquery reactjs

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

SVG 动画:Chrome 中的缓慢/性能不佳

我们正在开发一个相当复杂的场景,其中包含许多移动部件,到目前为止还没有涉及任何 SVG 动画。

一切都很顺利并且表现良好,直到我们引入了一个带有几条虚线的 SVG,我们使用 stroke-dashoffset 属性对它们进行了动画处理。

它在 Edge 或 Firefox 中完全没有区别,但在 Chrome 中,整个场景的动画变得断断续续和缓慢。

我们甚至尝试了两种方法来达到相同的目的——CSS 关键帧和 SVG 元素内的 SMIL——但两者的表现同样糟糕。

是否有我们缺少的 Chrome 性能技巧?

编辑:示例

标记:

.stream {
  animation: stream 10s infinite;
}

@keyframes stream {
  100% {
    stroke-dashoffset: 100;
  }
}
Run Code Online (Sandbox Code Playgroud)
<svg version="1.0" id="streams" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 225.32 66.19" enable-background="new 0 0 225.32 66.19" xml:space="preserve">
      <path class="stream" fill="none" stroke="#000" stroke-width="1.75" stroke-linecap="round" stroke-miterlimit="10" stroke-dasharray="3,4" d="M107.38,50.54c0,0-6.78-84.52-106.51-22.2" />
      <path class="stream" fill="none" stroke="#000" stroke-width="1.75" stroke-linecap="round" stroke-miterlimit="10" stroke-dasharray="3,4" d="M110.49,45.31c-0.63-13.01-4.56-44.87-27.83-43.8c-27.6,1.27-37.33,39.66-38.49,60.34"/>
      <path class="stream" fill="none" stroke="#000" …
Run Code Online (Sandbox Code Playgroud)

javascript css performance animation svg

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

调整窗口大小时Bootstrap <select>宽度,内容太宽

如何使下拉大小适合内容(在我的情况下,它发生在缩小浏览器到小于某个特定大小,然后内容开始消失?我最好不要任何自定义CSS,任何内置到bootstrap到支持这个?

 <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<form class="form-horizontal" role="form" enctype="multipart/form-data" id="inputForm" name="inputForm" novalidate>
<div class="well">
<div class="form-group">
    <label class="col-xs-3 control-label"><strong>4.</strong>&nbsp;Select thing</label>
    <div class="col-xs-2">
        <select class="form-control">
            <option>Short
            </option>
            <option>Medium lenght
            </option>
            <option>Much much much longer text not fitting when resizing
            </option>
        </select>
    </div>
</div>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap

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

如何仅使用 CSS 定位可见的第一个子级(在设置为 display:none 的子级之后)

我需要<td>定位表行中可见的第一个元素——这意味着它没有display:none.

这是有问题的:

  • 它们并不总是隐藏的
  • 有时隐藏不止一个。
  • 我无法编辑 HTML 或使用 javascript/jQuery——这需要是一个纯 CSS 解决方案(希望如此)

以下是代码的快速示例:

<table>
    <thead>
        <tr>
            <th style="display:none">Header1</th>
            <th>Header2</th>
            <th>Header3</th>
            <th>Header4</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td style="display:none">Body1</td>
            <td>Body2</td>
            <td>Body3</td>
            <td>Body4</td>
        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

我尝试搞乱这样的事情但无济于事:

table > tbody > tr > td:first-of-type:not([style*="display:none"]) 
Run Code Online (Sandbox Code Playgroud)

这是一个要搞乱的小提琴

提前致谢。

css

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

Bootstrap 无法与 React 一起使用

我正在尝试将 Bootstrap 属性应用于我的<span><button>. 我不确定我做错了什么。我在 stackoverflow 中搜索了这个问题,但所有建议都说将类更改为 className。我已经做到了这一点,但我仍然看不到我的风格发生变化。

索引.js

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import Counter from './components/counter';

ReactDOM.render(<Counter/>, document.getElementById('root'));
registerServiceWorker();
Run Code Online (Sandbox Code Playgroud)

计数器.jsx

import React, { Component } from 'react';

class Counter extends Component {
    state = {
        count: 0
    };
    render() {
        return (
            <div>
                <span className="badge badge-primary m-2">
                    {this.formatCount()}
                </span>
                <button className="btn btn-secondaty btn- 
sm">Increment</button>
            </div>
        );
    }
    formatCount() {
        const { count …
Run Code Online (Sandbox Code Playgroud)

reactjs bootstrap-4

5
推荐指数
2
解决办法
5274
查看次数

在打字稿中选择材质 UI

我使用 Material UI 选择创建了一个下拉菜单。它说“搜索”。当我们点击它时,它会给我们一个列表。当我选择其中一个选项时,我想存储该选项并将“搜索方式”更改为所选的选项。

export default function UserSearchPage(){
  const [criteria, setCriteria] = useState('');
  const [searchItem, setSearchItem] = useState('');
  return (
    <div>
      <div className='main-content'>
        <Select 
          value = {criteria}
          onChange={
            value => { setCriteria(value);}
          }
          displayEmpty
        >
          <MenuItem disabled value="">
            <em>Search By</em>
          </MenuItem>
          <MenuItem value={1}>First Name</MenuItem>
          <MenuItem value={2}>Last Name</MenuItem>
          <MenuItem value={3}>Phone Number</MenuItem>
          <MenuItem value={4}>Email</MenuItem>
        </Select>
      </div>
    )
    </div>
  );
}
Run Code Online (Sandbox Code Playgroud)

目前, onChange 给了我这个价值错误:

Argument of type 'ChangeEvent<{ name?: string | undefined; value: unknown; }>' is not assignable to parameter of type 'SetStateAction<string>'. …
Run Code Online (Sandbox Code Playgroud)

javascript typescript reactjs react-native material-ui

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

如何打开一个 url 作为引导模式窗口?

我有这行 PHP:


$STRING .= $b_f.'<a href="'.get_home_url().'/wp-login.php" class="ua5 '.$linkclass.'">'.$CORE->_e(array('head','5','flag_link')).'</a>'.$b_a;
Run Code Online (Sandbox Code Playgroud)

这个网址现在作为一个新网页打开。如何将其作为对话框/模式窗口打开?在我的代码中,我安装了引导程序。

php wordpress modal-dialog twitter-bootstrap

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