@@ -211,12 +211,14 @@ const Appbar = ({
211211
212212 React . Children . forEach ( children , ( child ) => {
213213 if ( React . isValidElement ( child ) ) {
214+ const isLeading = child . props . isLeading === true ;
215+
214216 if ( child . type === AppbarContent ) {
215217 hasAppbarContent = true ;
216- } else if ( hasAppbarContent ) {
217- rightItemsCount ++ ;
218- } else {
218+ } else if ( isLeading || ! hasAppbarContent ) {
219219 leftItemsCount ++ ;
220+ } else {
221+ rightItemsCount ++ ;
220222 }
221223 }
222224 } ) ;
@@ -254,18 +256,32 @@ const Appbar = ({
254256 { ...rest }
255257 >
256258 { shouldAddLeftSpacing ? < View style = { spacingStyle } /> : null }
257- { ( ! isV3 || isMode ( 'small' ) || isMode ( 'center-aligned' ) ) &&
258- renderAppbarContent ( {
259- children : [
259+ { ( ! isV3 || isMode ( 'small' ) || isMode ( 'center-aligned' ) ) && (
260+ < >
261+ { /* Render only the back action at first place */ }
262+ { renderAppbarContent ( {
263+ children,
264+ isDark,
265+ theme,
266+ isV3,
267+ renderOnly : [ 'Appbar.BackAction' ] ,
268+ shouldCenterContent : isV3CenterAlignedMode || shouldCenterContent ,
269+ } ) }
270+ { /* Render the rest of the content except the back action */ }
271+ { renderAppbarContent ( {
260272 // Filter appbar actions - first leading icons, then trailing icons
261- ...filterAppbarActions ( children , true ) ,
262- ...filterAppbarActions ( children ) ,
263- ] ,
264- isDark,
265- theme,
266- isV3,
267- shouldCenterContent : isV3CenterAlignedMode || shouldCenterContent ,
268- } ) }
273+ children : [
274+ ...filterAppbarActions ( children , true ) ,
275+ ...filterAppbarActions ( children ) ,
276+ ] ,
277+ isDark,
278+ theme,
279+ isV3,
280+ renderExcept : [ 'Appbar.BackAction' ] ,
281+ shouldCenterContent : isV3CenterAlignedMode || shouldCenterContent ,
282+ } ) }
283+ </ >
284+ ) }
269285 { ( isMode ( 'medium' ) || isMode ( 'large' ) ) && (
270286 < View
271287 style = { [
0 commit comments