Explore key concepts of React Native core APIs and foundational architecture with this beginner-friendly quiz. Strengthen your understanding of essential components, navigation, and platform integration, ideal for those starting with mobile app development using React Native.
Which core component should you use to display read-only text in a React Native mobile application?
Explanation: The 'Text' component is the correct choice for displaying read-only text content in React Native. 'Input' is used for accepting user input and is not meant for static text. 'Textbox' is not a valid component in React Native and may be confused with components from other frameworks. 'String' is simply a JavaScript data type, not a display element.
Which built-in hook allows functional components in React Native to manage local state?
Explanation: The 'useState' hook lets you manage state in functional components and is a core part of the React API. 'setStatus' and 'updateState' are not standard hooks or functions in React Native. 'stateManager' may sound logical but is not a built-in method or hook.
If you want to arrange elements vertically on the screen in React Native using the default layout, which property will you configure?
Explanation: 'flexDirection' is used to specify the axis (row or column) along which children of a container are laid out. 'alignItems' controls alignment on the cross-axis rather than direction. 'displayType' and 'verticalAlign' do not exist as layout properties in React Native and are incorrect.
To execute code only on Android devices, which function should you use to detect the platform?
Explanation: 'Platform.OS' checks the current platform, allowing developers to run code conditionally based on whether it's 'android' or 'ios'. 'DeviceType', 'OSCheck', and 'SystemType' are not built-in methods for this purpose and might lead to errors if used.
Which navigation pattern in React Native allows users to move forward and back through a history of screens, similar to a stack of cards?
Explanation: Stack navigation models the history of screens like a stack, where you push and pop screens. Tab navigation displays screens side by side with tabs, while drawer navigation shows a sliding menu. Grid navigation is not a common navigation pattern in React Native.
Which component is commonly used in React Native to allow users to enter and edit text?
Explanation: 'TextInput' is the standard React Native component for collecting user text input. 'InputField', 'EditText', and 'EntryBox' are either incorrect or belong to other frameworks or platforms, making them unsuitable choices.
What is the recommended core component for displaying images fetched from a URL in React Native?
Explanation: The 'Image' component is specifically designed for rendering image resources, including those from remote URLs. 'Picture', 'Media', and 'Photo' are incorrect, as they are not core components in React Native for displaying images.
Which component would you use to create a button-like element that responds to user taps in React Native?
Explanation: 'TouchableOpacity' provides visual feedback and responds when users tap on it. 'TapArea', 'ButtonBox', and 'ClickView' are not valid React Native components, so using them would not produce the intended interactive behavior.
When starting a new React Native project, what is the typical default root component of the app?
Explanation: 'App' is the typical root component created when you initialize a new React Native project. 'Main', 'Index', and 'Root' are meaningful names, but they are not the standard default entry-point component.
Which core API enables you to access device features like the camera or location in React Native?
Explanation: 'Native Modules' allow JavaScript code to interact with device capabilities such as the camera or location services. 'DeviceConnect', 'FeatureHooks', and 'CapabilityManager' are not built-in APIs and will not provide access to hardware features in the same way.