Commit 924772c4 authored by Thor-Herman's avatar Thor-Herman
Browse files

Merge branch search into master

Squashed commit of the following:

commit 269bed8e
Author: Thor-Herman <44784559+Thor-Herman@users.noreply.github.com>
Date:   Thu Nov 12 09:24:16 2020 +0100

    Add handleChange and onSubmit to searchbar #9

commit 923c93be
Author: Thor-Herman <44784559+Thor-Herman@users.noreply.github.com>
Date:   Thu Nov 12 09:23:49 2020 +0100

    Update gitignore
parent be7069f1
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
# Bundle artifacts
*.jsbundle
# CocoaPods
/ios/Pods/
# Expo
.expo/*
web-build/
import { Container, Icon, Input, Item, View } from 'native-base';
import React from 'react';
import React, { Props, useEffect } from 'react';
import { NativeSyntheticEvent, TextInputChangeEventData, TextInputSubmitEditingEventData } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { Link } from 'react-router-native';
import { searchMovieTitles, searchMovies } from '../actions';
import { RootState } from '../reducers';
const SearchBar = () => {
const dispatch = useDispatch();
const handleChange = (e: NativeSyntheticEvent<TextInputChangeEventData>): void => {
const term = e.nativeEvent.text;
dispatch(searchMovieTitles(term)); // Update the search term
}
const onSubmit = (e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => {
e.preventDefault();
dispatch(searchMovies(true)); // Perform search with current searchTerm
}
return (
<>
<Item style={{flex: 4}}>
<Icon name='search' />
<Input placeholder='Search for a movie...' />
<Input placeholder='Search for a movie...' onSubmitEditing={onSubmit} onChange={handleChange} />
</Item>
</>
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment