小编Fab*_*hor的帖子

删除复选框的"已选中"属性

发生错误时,我需要删除一个复选框的"已检查"属性.

.removeAttr函数不起作用.任何的想法?:/

HTML

<div data-role="controlgroup" data-type="horizontal" data-mini="true" style="margin-left: auto; margin-right: auto; width: 100%; text-align: center;">
    <input type="checkbox" id="captureImage" name="add_image" class="custom" />
    <label for="captureImage" data-icon="checkbox">Image</label>
    <input type="checkbox" id="captureAudio" name="add_audio" class="custom" />
    <label for="captureAudio" data-icon="checkbox">Audio</label>
    <input type="checkbox" id="captureVideo" name="add_video" class="custom" />
    <label for="captureVideo" data-icon="checkbox">Video</label>
</div>
Run Code Online (Sandbox Code Playgroud)

使用Javascript

$("#captureImage").live("change", function() {
    // $("#captureImage").prop('checked', false); // Here Work

    if($("#captureImage:checked").val() !== undefined) {
            navigator.device.capture.captureImage(function(mediaFiles) {
            console.log("works");
        }, function(exception) {
            $("#captureImage").prop('checked', false); // Not Works Here
            _callback.error(exception);
        }, {limit: 1});
    }
});

/*
$("#captureAudio").live("change", function() {
    if($("#captureAudio:checked").val() …
Run Code Online (Sandbox Code Playgroud)

javascript jquery ios jquery-mobile cordova

45
推荐指数
4
解决办法
18万
查看次数

中心组件如何在React Native中使用Flex?

我很难使用CSS在屏幕上集中我的组件。

看我的App.js

import { Container } from 'native-base';
import React from 'react';
import { StyleSheet } from 'react-native';

import Screen from './ScreenContainer';

const styles = StyleSheet.create({
  container: {
    backgroundColor: '#FF6666',
    flex: 1
  }
});

const App = () => (
  <Provider store={store}>
    <Container style={styles.container}>
      <Screen />
    </Container>
  </Provider>
);

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

现在,看看我的 ScreenContainer.js

import { Container, Content, Form, Input, Label, Item } from 'native-base';
import React from 'react';

import AppLogo from '../components/AppLogo';

const Screen = () => …
Run Code Online (Sandbox Code Playgroud)

css flexbox reactjs react-native react-native-android

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

为什么 onLayout 不会在子文本中触发?

我有一个关于 onLayout 事件的问题

代码

<View>
  <Text>
    <Text onLayout={e => {console.log("this isn't triggered!")}}>{"foo"}</Text>
  </Text>
</View>
Run Code Online (Sandbox Code Playgroud)

B代码

<View>
  <Text onLayout={e => {console.log("here the event it is called, but I need call in a SubText")}}>{"foo"}</Text>
</View>
Run Code Online (Sandbox Code Playgroud)

react-native

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

连续文本组件中的空文本空间反应原生

我有这个问题:

在此输入图像描述

我需要在第一行中加上"dummy"这个词,直到该行完成.

您可以在此处查看示例:https://snack.expo.io/B1KcRgGWX

代码:

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

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <View style={styles.paragraphs}>
          <Text style={styles.textParagraph}>Lorem Ipsum is</Text>
          <Text style={styles.emptyTerm} />
          <Text style={styles.textParagraph}>dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-android

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

按部件名称获取课程数量

我有以下元素:

<ul id="towns">
    <li class="clearfix odd 516_499_132_0_0 town132">...</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

我需要为一个参数提取类"town132",但是数字 - 例如132 - 是可变的.

我如何提取?

$('#towns').children('li').each(function() {
    parameter = $(this). // ???
});
Run Code Online (Sandbox Code Playgroud)

javascript regex string jquery replace

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

StyleSheet - 在 React Native 中扩展样式值

存在某种方法可以做这样的事情吗?

const styles = StyleSheet.create({
  content: {
    alignItems: 'center',
    flex: 1,
    justifyContent: 'center'
  },
  mainColor: { color: '#FFFFFF' },
  usernameIcon: {
    {this.styles.mainColor} // <-- How import the style, instead does write the code - color: '#FFFFFF'?
  },
  usernameItem: {
    backgroundColor: '#FF8484',
    borderColor: '#FFFFFF',
    paddingTop: 7
  },
});
Run Code Online (Sandbox Code Playgroud)

在我的组件中添加许多类,这非常冗长,我可能会做类似上面代码的事情。

css stylesheet react-native

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