A dynamic Questions and Answers section for your react-native app.
React Native
import AnswerInput from './answerInput';
import QuestionAnswered from './questionAnswered';
Libraries you need to install
import React from 'react';
import { StyleSheet, video,ListView, ScrollView,FlatList, Platform, fontWeight, Image, backgroundColor, Text, fontFamily, fontSize, View, Button, TouchableHighlight, TextInput, TouchableOpacity, Alert,} from 'react-native';
import {RkButton} from 'react-native-ui-kitten';
import Swipeout from 'react-native-swipeout';
import ViewMoreText from 'react-native-read-more-text';
Under every question, there is an input when pressin Answer. After answering, the answer and the question go to the other page, under 'Answered'.
Examples:
addNewAnswer(newAnswer){
console.log('calling addNewAnswer in questions')
var newAnswerList = this.state.answers;
console.log('pushing new answer:' + JSON.stringify(newAnswer))
newAnswerList.push(newAnswer)
console.log('updating status with new answers list')
this.setState({answers: newAnswerList})
this.setState({status: false})
console.log('hiding card')
this.setState({cardVisible: false})
}
renderToAnswer(){
return this.state.questions.map(this.returnAnswerInputForQuestion.bind(this))
}