Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIManager::manageChildren arrays reconciliation support #253

Closed
maxhora opened this issue Jun 13, 2018 · 0 comments
Closed

UIManager::manageChildren arrays reconciliation support #253

maxhora opened this issue Jun 13, 2018 · 0 comments
Assignees

Comments

@maxhora
Copy link
Contributor

maxhora commented Jun 13, 2018

UIManager::manageChildren implementation introduces issues on some scenarios.

Possibly, it happens because input argument addAtIndices may contain any range of values to add new element at, but current implementation, seems, adds new items only to the end of parent containers list (QQuickItem API to insert new child at specific position seems is not available ? ):

child->setParentItem(container);

JS source sample with issues:

import React, { Component } from 'react';
import {
 AppRegistry,
 Alert,
 Text,
 TouchableHighlight,
 View,
 TextInput,
 Button
} from 'react-native';



class ItemList extends Component {
 constructor(props) {
   super(props);
   this.state = {longList: true};
   this.onPress = this.onPress.bind(this);
 }

 onPress() {
   this.setState({longList: !this.state.longList});
 }

 onButtonPress() {
  this.setState({longList: !this.state.longList});
 }

 render() {
   let items = this.state.longList ? ["Long11", "Long22", "Long23"] : ["Long22", "Long23"];
   return (
     <View onPress={this.onPress}>

       <View>
       {items.map(function(name, index) {
         return <Button key={name} title={name} > </Button>;
       })}
       </View>
     </View>
   )
 }
}

class rn_list extends Component {
 render() {
   return (
     <ItemList/>
   );
 }
}

AppRegistry.registerComponent('rn_list', () => rn_list);
``

The issue doesn't happen if in sample above to update line with arrays values to the following:

let items = this.state.longList ? ["Long11", "Long22", "Long23"] : ["Long11", "Long22"];


Nice to implement some automated tests to verify work results of UIManager::manageChildren
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants