我升级到最新版本的React/RN:"react":"^ 15.2.1","react-native":"^ 0.30.0",
我开始收到很多关于样式表的警告.我实际上没有对样式表使用React.PropTypes验证,那么为什么要抛出这些警告呢?
const styles = StyleSheet.create({
welcome: {
fontSize: 20,
textAlign: "center",
margin: 10,
},
Run Code Online (Sandbox Code Playgroud)
ExceptionsManager.js:76警告:您正在手动调用
fontSizeprop 的React.PropTypes验证函数StyleSheet welcome.这已弃用,不适用于下一个主要版本.由于第三方PropTypes库,您可能会看到此警告.有关 详细信息,请参阅https://facebook.github.io/react/warnings/dont-call-proptypes.html.reactConsoleError @ExceptionsManager.js:76警告:您正在手动调用
textAlignprop 的React.PropTypes验证函数StyleSheet welcome.这已弃用,不适用于下一个主要版本.由于第三方PropTypes库,您可能会看到此警告.请参阅https://facebook.github.io/react/warnings/dont-call-proptypes.htmlExceptionsManager.js:76警告:您正在手动调用
marginprop 的React.PropTypes验证函数StyleSheet welcome.这已弃用,不适用于下一个主要版本.由于第三方PropTypes库,您可能会看到此警告.有关 详细信息,请参阅https://facebook.github.io/react/warnings/dont-call-proptypes.html.
为TextInput组件对齐占位符文本的最佳原因是什么.我已经尝试使用如下所述的样式组件.这似乎没有和属性.
render() {
return (
<View style={styles.container}>
<TextInput
style={styles.textInput}
onChangeText={(text) => this.setState({
username: text
})}
placeholder='Add Username'
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
textInput: {
height: 40,
width: 200,
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
borderColor: 'gray',
borderWidth: 1,
}
});
Run Code Online (Sandbox Code Playgroud) 我试图确定双精度的最大精度是多少.在此链接中的已接受答案的注释中,在Java中保留精度为double @PeterLawrey表示最大精度为15.
你怎么决定这个?
您有没有办法自定义组件的ID(我知道它可以为视图完成...但是自ember 1.13以来已经弃用了视图):
例如,以下内容适用于该视图:
export default Ember.View.extend({
classNames: ['music-js', 'vjs-default-skin', 'center-x','center-block'],
attributeBindings: ['id'],
id: 'musicOne',
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试对组件使用id绑定时,我在控制台日志中获得异常:
export default Ember.Component.extend({
classNames: ['music-js', 'vjs-default-skin', 'center-x','center-block'],
attributeBindings: ['id'],
id: 'musicOne',
Run Code Online (Sandbox Code Playgroud)
未捕获的TypeError:提供的元素或ID无效.
嗨,我正在尝试春季junit测试用例......我需要加载我的完整应用程序上下文.但是,junit测试不会初始化完整的应用程序上下文.
测试类:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
public class MongoDbRepositoryTest {
@Value("${spring.datasource.url}")
private String databaseUrl;
@Inject
private ApplicationContext appContext;
@Test
public void testCRUD() {
System.out.println("spring.datasource.url:" + databaseUrl);
showBeansIntialised();
assertEquals(1, 1);
}
private void showBeansIntialised() {
System.out.println("BEEEAAANSSSS");
for (String beanName : appContext.getBeanDefinitionNames()) {
System.out.println(beanName);
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
spring.datasource.url:${spring.datasource.url}
BEEEAAANSSSS
org.springframework.context.annotation.internalConfigurationAnnotationProcessor
org.springframework.context.annotation.internalAutowiredAnnotationProcessor
org.springframework.context.annotation.internalRequiredAnnotationProcessor
org.springframework.context.annotation.internalCommonAnnotationProcessor
org.springframework.context.annotation.internalPersistenceAnnotationProcessor
org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor
org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor
Run Code Online (Sandbox Code Playgroud)
主要应用类注释:
@ComponentScan(basePackages = "com.test")
@EnableAutoConfiguration(exclude = { MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class })
@EnableMongoRepositories("com.test.repository.mongodb")
@EnableJpaRepositories("com.test.repository.jpa")
@Profile(Constants.SPRING_PROFILE_DEVELOPMENT)
public class Application { ...
Run Code Online (Sandbox Code Playgroud)
因此,它应该扫描com.test包中的所有spring bean,并将它们加载到Junit测试用例的applicationcontext中.但是从bean的产量来看,似乎并没有这样做.
我有以下目录结构/配置文件:
src/main/resource/config:
application.yml
application-dev.yml
application-sit.yml
Run Code Online (Sandbox Code Playgroud)
请注意根据" Bootiful Configuration " https://spring.io/blog/2015/01/13/configuring-it-all-out-or-12-factor-app-style-configuration-with-spring:
Spring Boot将默认读取src/main/resources/application.properties中的属性.如果配置文件处于活动状态,它还将根据配置文件名称自动读取配置文件,例如src/main/resources/application-foo.properties,其中foo是当前配置文件.如果Snake YML库在类路径上,那么它也会自动加载YML文件.
如果我--spring.profiles.active=dev在eclipse运行配置中设置为程序arg并且使用它作为我的主要方法,那么蛇YML jar在类路径中,永远按预期工作:
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
// Check if the selected profile has been set as argument.
// if not the development profile will be added
addDefaultProfile(app, source);
app.run(args);
}
/**
* Set a default profile if it has not been set
*/
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
if …Run Code Online (Sandbox Code Playgroud) 由于性能原因,我想直接更新组件的值.
render(){
<View>
<Text style={styles.welcome} ref={component => this._text = component}>
Some Text
</Text>
<TouchableHighlight underlayColor='#88D4F5'
style={styles.button}>
<View>
<Text style={styles.buttonText}
onPress={this.useNativePropsToUpdate.bind(this)}>
Iam the Child
</Text>
</View>
</TouchableHighlight>
</View>
}
Run Code Online (Sandbox Code Playgroud)
这是我用来更新文本组件的方法.我不知道我是否正在设置正确的属性/如何确定要设置的属性:
useNativePropsToUpdate(){
this._text.setNativeProps({text: 'Updated using native props'});
}
Run Code Online (Sandbox Code Playgroud)
本质上尝试遵循此示例中的相同方法:https: //rnplay.org/plays/pOI9bA
编辑:当我尝试显式分配更新的值时:
this._text.props.children = "updated";
Run Code Online (Sandbox Code Playgroud)
(我知道这是在RN中做事的正确方法).我收到错误"无法分配给对象'#'的只读属性'子''
所以也许这就是为什么它因某些原因无法在RN中更新的原因?
这更像是一个概念问题,但我不确定解决问题的确切方法.
我有一个我想从中下载图像的组件,但我希望能够在用户可以使用router flux切换到它之前指示组件已加载.
我猜这是我必须在redux中完成的事情,这是正确的想法吗?我一直在努力寻找一个做出反应的本机应用程序的例子.
非常感谢!
任何有关这方面的帮助将不胜感激.我使用Spring,Jetty(Eclipse Jetty插件).似乎声明式事务管理@Transactional不起作用.
确认这在两个方面不起作用:1.在方法调用之后,新创建的实体不会刷新到数据库中.2. TransactionSynchronizationManager.isActualTransactionActive(); 返回false
请注意,下面的方法是@Controller类的一部分,其中http请求调用最终调用此save方法.控制器类不实现任何接口.实际代码:
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void save(PERule peRule) {
boolean inTransaction = TransactionSynchronizationManager.isActualTransactionActive();
peRuleDAOImpl.persist(peRule);
}
Run Code Online (Sandbox Code Playgroud)
日志输出也确认了缺少事务:
DEBUG: org.hibernate.internal.SessionImpl - Opened session at timestamp: 13762325621
DEBUG: org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl - Skipping
JTA sync registration due to auto join checking
DEBUG: org.hibernate.ejb.AbstractEntityManagerImpl - Looking for a JTA transaction to join
DEBUG: org.hibernate.ejb.AbstractEntityManagerImpl - Unable to join JTA transaction
DEBUG: org.hibernate.event.internal.AbstractSaveEventListener - Delaying identity-insert due to no transaction in progress
Run Code Online (Sandbox Code Playgroud)
但是,当我以编程方式定义显式事务边界并提交事务时,实体将被刷新到数据库中.例如:
@Resource
private PlatformTransactionManager txManager;
private void save(PERule peRule) { …Run Code Online (Sandbox Code Playgroud) 尽管遵循此链接Ember.js上的说明:HtmlBars和Handlebars.compile命令,但仍然出现下面的错误。
下面,我复制并粘贴了package.json,bower.json和brocfile.js。不知道是什么原因引起的。
未捕获的错误:在未compile加载模板编译器的情况下无法调用。请ember-template-compiler.js在致电之前加载compile。
package.json
{
"name": "ui",
"version": "0.0.0",
"description": "Small description for ui goes here",
"private": true,
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"start": "ember server",
"build": "ember build",
"test": "ember test"
},
"repository": "",
"engines": {
"node": ">= 0.10.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"bower": "^1.3.12",
"broccoli-asset-rev": "^2.0.2",
"broccoli-funnel": "^0.2.3",
"broccoli-merge-trees": "^0.2.1",
"ember-cli": "0.2.7",
"ember-cli-app-version": "0.3.3",
"ember-cli-babel": "^5.0.0",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-cookie": "^0.1.0",
"ember-cli-dependency-checker": …Run Code Online (Sandbox Code Playgroud) java ×4
react-native ×4
spring ×3
ember.js ×2
spring-boot ×2
double ×1
ember-cli ×1
jetty ×1
junit ×1
precision ×1
spring-mvc ×1
spring-test ×1
tomcat ×1